<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
         contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>添加场地 -体育馆网上系统</title>
    <link href=" ${pageContext.request.contextPath}/static/cssa/nav.css" rel="stylesheet" type="text/css"/>
    <script src="${pageContext.request.contextPath}/static/js/nav.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/focus.js" type="text/javascript"></script>
    <link href=" ${pageContext.request.contextPath}/static/cssa/common.css" rel="stylesheet" type="text/css"/>
    <link href=" ${pageContext.request.contextPath}/static/cssa/ground.css" rel="stylesheet" type="text/css"/>

    <script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
    <script type="text/javascript">
      function check(frm) {
        var placeName = frm.placeName.value;
        var money = frm.money.value;
        if (placeName.length == 0 || money.length == 0) {
          alert("111")
          return false;
        }
        if (!isNumber1(money)) {
          document.getElementById("pm").innerHTML = "请输入数字";
          return false;
        }
        return true;
      }

      function isNumber1(str) {
        if(str==null||str.length==0) {return false;}
        for(var i=0;i&lt;str.length;i++) {
          var ch = str.charAt(i);
          if("0123456789".indexOf(ch)==-1) {return false;}//没找到返回-1
        }
        return true;
      }
    </script>
</head>

<body>
<%@ include file="../header.jsp" %>
<div id="main">
    <div id="row_1">
        <div id="ground-add">
            <form action="${pageContext.request.contextPath}/place/addPlace" method="post"
                  onsubmit="return check(this)">
                <p>类型
                    <select name="type" class="input_text">
                        <c:forEach items="${typeList}" var="list">
                            <option value="${list.getType()}">${list.getTypeName()}</option>
                        </c:forEach>
                    </select>
                </p>
                <p>名称
                    <input name="placeName" type="text" class="input_text"/><span id="pn" style="color: red;" ></span><br>
                </p>
                <p>资费
                    <input name="money" type="text" class="input_text"/><span id="pm" style="color: red;" ></span><br>
                </p>
                <p>
                    <input name="action" type="hidden" value="add"/>
                    <input name="submit" type="submit" class="btn_submit" value="添加"/>
                    <input name="" type="reset" class="btn_submit" value="重置"/>
                </p>
            </form>
        </div>
    </div>
</div>
<script>
  var def = "4";
</script>
<%@ include file="../footer.jsp" %>
</body>
</html>
